package practice;

import java.util.Scanner;

public class Bonus {
	public static final long LIMIT_10 = 100000;
	public static final long LIMIT_20 = 200000;
	public static final long LIMIT_40 = 400000;
	public static final long LIMIT_60 = 600000;
	public static final long LIMIT_100 = 1000000;
	private long profit;
	private double bonus;
	public Bonus(long profit) {
		this.profit = profit;
		bonus = 0;
	}
	
	public void calculate() {
		long[] limit = new long[] {0, LIMIT_10, LIMIT_20, LIMIT_40, 
				LIMIT_60, LIMIT_100, Long.MAX_VALUE};
		double[] rate = new double[] {0.1, 0.075, 0.05, 0.03, 0.015, 0.01};
		for (int i = 0; i < rate.length; i++) {
				long temp = profit - limit[i];
				if (temp <= 0)
					break;
				if (profit > limit[i + 1])
					temp = limit[i + 1] - limit[i];
				bonus += temp * rate[i];
		}
		System.out.println("应发总奖金为：" + bonus);
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.print("请输入利润：");
		new Bonus( scan.nextLong()).calculate();
	}

}
